package com.zetyun.tiger.sql.oracle;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.text.StrFormatter;
import com.zetyun.tiger.sql.dkm.GenSrDkmApp;

import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Objects;

public class OracleOrgApp {

    public static void main(String[] args) {
        List<String> lines = FileUtil.readLines(Objects.requireNonNull(
                GenSrDkmApp.class.getResource("/val.txt")), StandardCharsets.UTF_8);
        String sql = "insert into ODS_PEMS_ORG_RELA_SORT(CORPORATION,DAY_ID,ORG_CD,ORG_NAME,PARENT_ORG_CD,P_SORT,S_SORT) values ";
        String template = "insert into ODS_PEMS_ORG_RELA_SORT(CORPORATION,DAY_ID,ORG_CD,ORG_NAME,PARENT_ORG_CD,P_SORT,S_SORT) values ('{}','{}','{}','{}','{}','{}','{}') ; ";
        for (String line : lines) {
            String[] arr = line.split("\t");
            String CORPORATION = arr[0];
            String DAY_ID = arr[1];
            String ORG_CD = arr[2];
            String ORG_NAME = arr[3];
            String PARENT_ORG_CD = arr[4];
            String P_SORT = arr[5];
            String S_SORT = arr[6];
            System.out.println(StrFormatter.format(template,
                    CORPORATION,DAY_ID,ORG_CD,ORG_NAME,PARENT_ORG_CD,P_SORT,S_SORT
            ));
        }
    }
}
